import service from '@/utils/request'

// @Tags ProductSpec
// @Summary 创建产品规格
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.ProductSpec true "创建产品规格"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
// @Router /productSpec/createProductSpec [post]
export const createProductSpec = (data) => {
  return service({
    url: '/productSpec/createProductSpec',
    method: 'post',
    data
  })
}

// @Tags ProductSpec
// @Summary 删除产品规格
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.ProductSpec true "删除产品规格"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
// @Router /productSpec/deleteProductSpec [delete]
export const deleteProductSpec = (params) => {
  return service({
    url: '/productSpec/deleteProductSpec',
    method: 'delete',
    params
  })
}

// @Tags ProductSpec
// @Summary 批量删除产品规格
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.IdsReq true "批量删除产品规格"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
// @Router /productSpec/deleteProductSpec [delete]
export const deleteProductSpecByIds = (params) => {
  return service({
    url: '/productSpec/deleteProductSpecByIds',
    method: 'delete',
    params
  })
}

// @Tags ProductSpec
// @Summary 更新产品规格
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.ProductSpec true "更新产品规格"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
// @Router /productSpec/updateProductSpec [put]
export const updateProductSpec = (data) => {
  return service({
    url: '/productSpec/updateProductSpec',
    method: 'put',
    data
  })
}

// @Tags ProductSpec
// @Summary 用id查询产品规格
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query model.ProductSpec true "用id查询产品规格"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
// @Router /productSpec/findProductSpec [get]
export const findProductSpec = (params) => {
  const { version } = params;
  return service({
    url: version ? '/productSpec/getProductSpecHistory': `/productSpec/findProductSpec`,
    method: 'get',
    params
  })
}

// @Tags ProductSpec
// @Summary 分页获取产品规格列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query request.PageInfo true "分页获取产品规格列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /productSpec/getProductSpecList [get]
export const getProductSpecList = (params) => {
  return service({
    url: '/productSpec/getProductSpecList',
    method: 'get',
    params
  })
}

// 获取片弧弯列表
export const getArcBendList = (params) => {
  return service({
    url: '/arcBend/getArcBendList',
    method: 'get',
    params
  })
}

//获取电镀色列表
export const zcbPlateRead = (data) => {
  return service({
    url: '/saprfc/zcbPlateRead',
    donNotShowLoading: true,
    method: 'post',
    data
  })
}

//获取包装纸列表
export const getPackagePapperPositionList = (params) => {
  return service({
    url: '/packagePapperPosition/getPackagePapperPositionList',
    donNotShowLoading: true,
    method: 'get',
    params
  })
}

//通过底层sap接口获取颜色
export const getSapColor = (data) => {
  return service({
    url: '/productSpec/getSapColor',
    donNotShowLoading: true,
    method: 'post',
    data
  })
}

//获取新眼型编号
export const getEyeData = (data) => {
  return service({
    url: '/productSpec/getEyeData',
    donNotShowLoading: true,
    method: 'post',
    data
  })
}

//获取首办参考编号
export const getFirstOrderNum = (data) => {
  return service({
    url: '/productSpec/getFirstOrderNum',
    donNotShowLoading: true,
    method: 'post',
    data
  })
}
//获取新脾型编号
export const getSpleenData = (data) => {
  return service({
    url: '/productSpec/getSpleenData',
    donNotShowLoading: true,
    method: 'post',
    data
  })
}

//获取新硬膜编号
export const getHardMoldNum = (data) => {
  return service({
    url: '/productSpec/getHardMoldNum',
    donNotShowLoading: true,
    method: 'post',
    data
  })
}
// 创建眼型脾型编号
export const updateSpleenNumber = (data) => {
  return service({
    url: '/spleenNumber/updateSpleenNumber',
    donNotShowLoading: true,
    method: 'put',
    data
  })
}

//获取配件列表
export const getAccessoryList = (data) => {
  return service({
    url: '/productSpec/getAccessoryList',
    donNotShowLoading: true,
    method: 'post',
    data
  })
}

// 通过元件编号获取sap子层元件数据
export const getSapSubBom = (data) => {
  return service({
    url: '/productSpec/getSapSubBom',
    donNotShowLoading: true,
    method: 'post',
    data
  })
}

// 产品规格-颜色 生成本厂颜色描述
export const genLocalColorDesc = (data) => {
  return service({
    url: '/productSpecColor/genLocalColorDesc',
    donNotShowLoading: true,
    method: 'post',
    data
  })
}
// 根据 主模编号 材质和工序产生新的配件自制新编号
export const getNewAccessoryNumByMaterialWorkship = (data) => {
  return service({
    url: '/productSpecAccessorySpec/getProductSpecAccessorySpecComponentNum',
    method: 'post',
    donNotShowLoading: true,
    data
  })
}
// 获取外购新编号
export const getSelfMadeNewNum = (params) => {
  return service({
    url: '/productSpec/getSelfMadeNewNum',
    method: 'get',
    donNotShowLoading: true,
    params
  })
}

// 外购旧-根据元件编号获取相关信息saprfc/arfcGetMaterialLst
export const getArfcGetMaterial = (data) => {
  return service({
    url: '/saprfc/arfcGetMaterialLst',
    method: 'post',
    donNotShowLoading: true,
    data
  })
}
// 获取bom信息
export const getZrfcMatBomRead = (data) => {
  return service({
    url: '/saprfc/zrfcMatBomRead',
    method: 'post',
    donNotShowLoading: true,
    data
  })
}
// 根据配件主档编号和颜色编号查询详细信息
export const findAccessoryNumberDocument = (params) => {
  return service({
    url: '/accessoryNumberDocument/findAccessoryNumberDocument',
    method: 'get',
    donNotShowLoading: true,
    params
  })
}
// 精准获取配件编号主档
export const getAccessoryNumberDocumentNotLike = (params) => {
  return service({
    url: '/accessoryNumberDocument/getAccessoryNumberDocumentNotLike',
    method: 'get',
    donNotShowLoading: true,
    params
  })
}
// 
export const editProductSpec = (data) => {
  return service({
    url: '/productSpec/editProductSpec',
    method: 'put',
    donNotShowLoading: true,
    data
  })
}
// 打印
export const productSpecPrint = (params) => {
  return service({
    url: '/productSpec/print',
    method: 'get',
    donNotShowLoading: true,
    params
  })
}
// 待客确认
export const replicateProductSpec = (data) => {
  return service({
    url: '/productSpec/replicateProductSpec',
    method: 'post',
    donNotShowLoading: true,
    data
  })
}

// 标志图案工艺生成编号
export const generateWorkingProcedureNumber = (data) => {
  return service({
    url: '/workingProcedureNumberSetting/generateWorkingProcedureNumber',
    method: 'put',
    donNotShowLoading: true,
    data
  })
}

// 标志图案工艺生成编号
export const verifyProductSpec = (data) => {
  return service({
    url: '/productSpec/verifyProductSpec',
    method: 'put',
    donNotShowLoading: true,
    data
  })
}

/**
 * 获取历史版本
 * @param {*} params 
 * @returns 
 */
export const getProductSpecHistoryList = (params) => {
  return service({
    url: '/productSpec/getProductSpecHistoryList',
    method: 'get',
    donNotShowLoading: true,
    params
  })
}

// 产品规格锁定
export const createLockRecord = (data) => {
  return service({
    url: '/lockRecord/createLockRecord',
    method: 'post',
    donNotShowLoading: true,
    data
  })
}
// 产品规格删除锁定
export const deleteLockRecord = (params) => {
  return service({
    url: '/lockRecord/deleteLockRecord',
    method: 'DELETE',
    donNotShowLoading: true,
    params
  })
}
// 产品规格锁定查询
export const findLockRecord = (params) => {
  return service({
    url: '/lockRecord/findLockRecord',
    method: 'get',
    donNotShowLoading: true,
    params
  })
}